<extend name="Public/base" />

<block name="body">
    <div class="main-title" style="padding-bottom: 10px;" >
        <h2>扬州鲜生活电子出库单</h2>
    </div>
    <div class="row" ng-controller="StorageOutCtrl">
        <form action="{:U('outadd')}" method='post' class="form-horizontal" ng-init='init({$product})'>
            <input type="hidden" class="text input-large" name="batchNo" value="{$_batchNo}">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading" style="padding-bottom: 5px;padding-top: 5px;">
                        <span style="color:red;">批次号:{$_batchNo}</span>&nbsp;
                        <div class="form-item">
                            <div class="controls">
                                仓库：<select data-form="select2" style="height: 30px; width:307px;" name="wid">
                                        <volist name="_wlist" id="w">
                                            <if condition="($w.id == $_wid)">
                                                <option value="{$w.id},{$w.name}" selected="selected">{$w.name}</option>
                                                <else/>
                                                <option value="{$w.id},{$w.name}">{$w.name}</option>
                                            </if>
                                        </volist>
                                     </select>
                            </div>
                        </div>
                        <span class="check-tips"><button type="button" id="add_new" class='btn btn-primary' ng-click="moreItem()">添加新商品</button></span></div>
                    <div class="panel-body" style="padding-bottom: 0px;padding-top: 0px;">
                        <div class="form-item cf">
                            <div class="controls">
                                <div style="border: #000 1px solid;margin-top: 5px;margin-bottom: 5px;" class='data-table table-striped '>
                                    <table  id="tbodyspec">
                                        <thead>
                                        <tr>
                                            <th scope="col" width="20%">商品名称（规格）</th>
                                            <th scope="col" width="10%">商品编号</th>
                                            <th scope="col" width="20%">剩余数量</th>
                                            <th scope="col">出库数量</th>
                                            <th scope="col">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody id="tbodyspec_a">
                                            <tr ng-repeat="item in items">
                                                <td class="change">
                                                    <select select2  class="form-control input-sm" ng-change="select($index,x)" ng-model="x">
                                                        <option value="">请选择...</option>
                                                        <option ng-repeat="p in product" value="{{($index)}}" >{{p.pname}}({{p.spec}})</option>
                                                        <!--<volist name="_prolist" id="pl"><option data-num="{$pl.cnt}" value="{$pl.id}">{$pl.pname}({$pl.spec})</option></volist>-->
                                                    </select>
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control input-x" name="id[]" ng-model="item.id" readonly />
                                                </td>
                                                <td>
                                                    <span class="max_num" ng-bind="item.inventory"></span>
                                                    <input type="hidden" name="warnbatch[]" value="{{item.warnbatch}}">
                                                    <input type="hidden" name="warnid[]" value="{{item.warnid}}">
                                                </td>
                                                <td>
                                                    <input class="cnt form-control input-2x" type="text" ng-model="item.cnt" ng-change="cnt($index)" name="cnt[]" required />
                                                </td>
                                                <td><button type="button" class="btn btn-info" ng-click="removeItem($index)"> - </button></td>
                                            </tr>
                                        <!--读取商品信息-->
                                            <tr id="tflag"></tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-12">
                <button type="submit" class="btn confirm btn-danger">保 存</button>
                <a  class="btn btn-primary" id="fh" onclick="javascript:history.back(-1); return false;">返 回</a>
            </div>
        </form>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        highlight_subnav('{:U('Warehouse/outlist')}');
    </script>
</block>
